﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Collections.Specialized;
using System.Windows.Forms;

namespace HomeDmsPageStorageProviders
{
    public class DBTablePageStorageProvider : PageStorageProvider
    {
        public const string DataTableParamName = "dataTable";

        private string _dataTable;

        public string DataTable
        {
            get { return _dataTable; }
            set { _dataTable = value; }
        }

        public override string Description
        {
            get
            {
                return "Database table based page storage provider";
            }
        }

        public override string Name
        {
            get
            {
                return "DBTablePageStorageProvider";
            }
        }

        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);
            _dataTable = config[DataTableParamName];
            if (String.IsNullOrEmpty(_dataTable))
                _dataTable = "PAGESTORAGE";
        }

        public override void RetrievePage(string uri, out byte[] bytes)
        {
            // TODO:
            throw new NotImplementedException();
        }

        public override void UpdatePage(string uri, string name, byte[] bytes)
        {
            // TODO:
            throw new NotImplementedException();
        }

        public override string CreatePage(string name, byte[] bytes)
        {
            // TODO:
            throw new NotImplementedException();
        }

        public override void DeletePage(string uri)
        {
            // TODO:
            throw new NotImplementedException();
        }

        public override DialogResult ShowConfigurationDialog(IWin32Window owner)
        {
            // TODO:
            throw new NotImplementedException();
        }

        public override void WriteConfiguration(NameValueCollection nameValueCollection)
        {
            base.WriteConfiguration(nameValueCollection);
            // TODO:
            nameValueCollection[DataTableParamName] = _dataTable;
        }
    }
}
